package com.leo.chapter08;

import java.util.concurrent.ThreadFactory;

/**
 * 自定义线程工厂，定义了线程池的名字
 * @author xuexiaolei
 * @version 2017年10月18日
 */
public class MyThreadFactory implements ThreadFactory {
    private final String poolName;

    public MyThreadFactory(String poolName) {
        this.poolName = poolName;
    }

    @Override public Thread newThread(Runnable r) {
        return new MyAppThread(r, poolName);
    }
}
